package com.aipartner.mapper;

import com.aipartner.entity.ChatHistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * Chat History Mapper Interface
 * 
 * @author AI Partner Team
 * @since 2024-01-20
 */
@Mapper
public interface ChatHistoryMapper extends BaseMapper<ChatHistory> {
    
    /**
     * Get user chat history with pagination
     * 
     * @param page Page object
     * @param userId User ID
     * @return Paginated chat history
     */
    IPage<ChatHistory> selectUserChatHistory(Page<ChatHistory> page, @Param("userId") Long userId);
    
    /**
     * Get conversation chat history
     * 
     * @param page Page object
     * @param conversationId Conversation ID
     * @return Conversation chat history
     */
    IPage<ChatHistory> selectConversationHistory(Page<ChatHistory> page, @Param("conversationId") String conversationId);
    
    /**
     * Delete user chat history
     * 
     * @param userId User ID
     * @param historyId History ID
     * @return Number of affected rows
     */
    int deleteUserChatHistory(@Param("userId") Long userId, @Param("historyId") Long historyId);
}